import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import store from '@/store'

//执行mockServer.js
import '@/mock/mockServer'

//引入api并添加到原型上
import * as API from '@/api'
Vue.prototype.$API = API

//引入validate
import '@/plugins/validate'

//按需引入并使用elemenUI
import { MessageBox } from 'element-ui';
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

//图片懒加载
import VueLazyload from 'vue-lazyload'
import loading from '@/assets/images/loading.gif'
// 在图片界面没有进入到可视范围前不加载, 在没有得到图片前先显示loading图片
Vue.use(VueLazyload, { // 内部自定义了一个指令lazy
  loading,  // 指定未加载得到图片之前的loading图片
})



//引入并注册全局组件
//导航栏组件
import TypeNav from '@/components/TypeNav'
Vue.component(TypeNav.name,TypeNav)
//轮播图组件
import SwiperShow from '@/components/SwiperShow'
Vue.component(SwiperShow.name,SwiperShow)
//分页组件
import Pagination from '@/components/Pagination'
Vue.component(Pagination.name,Pagination)




Vue.config.productionTip = false

window.vm=new Vue({
  beforeCreate(){
    Vue.prototype.$bus=this
  },
  render: h => h(App),
  router,
  store,
}).$mount('#app')
